﻿<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
    <CodeSnippet Format="1.0.0">
        <Header>
            <Title>Define a property with a property changed callback for the ModelBase class</Title>
            <Shortcut>modelpropchanged</Shortcut>
            <Description>Code snippet for a property with a property changed callback for the ModelBase class</Description>
            <Author>CatenaLogic</Author>
            <SnippetTypes>
                <SnippetType>Expansion</SnippetType>
            </SnippetTypes>
        </Header>
        <Snippet>
            <Declarations>
                <Literal>
                    <ID>description</ID>
                    <ToolTip>Description of the property</ToolTip>
                    <Default>Gets or sets the property value</Default>
                </Literal>
                <Literal>
                    <ID>name</ID>
                    <ToolTip>Name of the property</ToolTip>
                    <Default>name</Default>
                </Literal>
                <Literal>
                    <ID>type</ID>
                    <ToolTip>Type of the property</ToolTip>
                    <Default>type</Default>
                </Literal>
                <Literal>
                    <ID>defaultvalue</ID>
                    <ToolTip>Default value of the property</ToolTip>
                    <Default>defaultvalue</Default>
                </Literal>
                <Literal>
                    <ID>ownerclass</ID>
                    <ToolTip>The owning class of this property. Typically the class that it is declared in.</ToolTip>
					<Function>ClassName()</Function>
					<Default>ClassNamePlaceholder</Default>
                </Literal>				
            </Declarations>
            <Code Language="csharp">
                <![CDATA[public $type$ $name$
{
    get { return GetValue<$type$>($name$Property); }
    set { SetValue($name$Property, value); }
}

public static readonly PropertyData $name$Property = RegisterProperty(nameof($name$), typeof($type$), $defaultvalue$, (sender, e) => (($ownerclass$)sender).On$name$Changed());

private void On$name$Changed()
{
    // TODO: Implement logic
}]]>
            </Code>
        </Snippet>
    </CodeSnippet>
</CodeSnippets>
